<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>添加主题--管理后台</title>
    <link th:href="@{/css/admin.css}" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="main">
    <div th:replace="admin/common :: #top"></div>
    <div th:replace="admin/common :: #opt_list"></div>
    <div id="opt_area">
        <ul class="classlist">
            <li th:each="news:${page.content}">
				<label th:text="${news.ntitle}"></label>
                <font>作者：</font>
				<b th:text="${news.nauthor}">&#160;&#160;&#160;&#160;</b>
				<span><a th:href="@{/news/toupdate(nid=${news.nid})}">修改</a> &#160;&#160;&#160;&#160;
					<a href='javascript:;' class="delnews" th:id="${news.nid}">删除</a>
				</span>
			</li>
            <li class='space'></li> 
        </ul>
        <p align="right"> 当前页数：[<span th:text="${page.number+1}"></span>/<span th:text="${page.totalPages}"></span> ]
		    <a th:href="@{/news/list(pageNo=1)}">首页</a>
            <a th:if="${page.hasPrevious()}" th:href="@{/news/list(pageNo=${page.number})}">上一页</a>
            <a th:if="${page.hasNext()}" th:href="@{/news/list(pageNo=${page.number+2})}">下一页</a>
            <a th:href="@{/news/newspage(pageNo=${page.totalPages})}">末页</a>
		</p>
    </div>
	<div th:replace="admin/common :: #footerbar"></div>
</div>
<script th:src="@{/js/jquery-1.8.3.min.js}"></script>
<script type="text/javascript">

    $(function (){
        /*var ctxpath = [[${#httpServletRequest.getContextPath()}]];*/
        $(".delnews").click(function (){
            if(confirm("确定删除？")){
                location.href="/newschina/news/delete?nid="+$(this).attr("id");
            }
        })
    })

   /* function del(obj){
        var ctxpath = [[${#httpServletRequest.getContextPath()}]];
        var nid = obj.getAttribute("id")
        if(confirm("确定删除？")){
            location.href="/newschina "
        }
    }*/
</script>
<!--<script th:src="@{/js/jquery-1.8.3.min.js}"></script>
<script type="text/javascript">
    var currPageNo=1;
    function getPage(pageNo){
        $("#pagebar").remove();
        $(".classlist").empty();
        $.ajax({//局部刷新
            url:'/newschina/index/pagenews/?pageNo='+pageNo,
            type:'get',
            dataType:'json',
            success:function (page){
                var data=page.newsList;
                $(data).each(function (i){
                    var $li = $("<li><a href=\'/newschina/index/readnews/" +this.nid+"'>"
                        +this.ntitle
                        +"</a><font>"+"作者："+"</font>"
                        +"<b>"+this.nauthor+"</b>"
                        +"<span><a href='news_modify.html'>修改</a> &#160;&#160;&#160;&#160;<a>删除</a></span></li>");

                    $(".classlist").append($li);
                    if((i+1)%5==0){
                        $(".classlist").append("<li class='space'></li>");
                    }
                });
                var $p = $("<p align=\"right\" id='pagebar'> 当前页数:["+page.pageNo+"/"+page.totalPageCount+"]&nbsp; <a href=\"javascript:;\" onclick='getPage(1)'>首页</a> <a href=\"javascript:;\" onclick=\"getPage("+(page.pageNo-1)+")\">上一页</a> <a href=\"javascript:;\" onclick=\"getPage("+(page.pageNo+1)+")\">下一页</a> <a href=\"javascript:;\" onclick='getPage("+page.totalPageCount+")'>末页</a> </p>");
                $(".classlist").append($p);
            }
        })
    }

    $(function (){
        getPage(1);
    })
</script>-->
</body>
</html>

	